package org.liuchang.login;

import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.awt.Color;
import javax.swing.border.LineBorder;
import javax.swing.JComboBox;
import java.awt.Font;

public class LoginPanel extends JPanel {

	Image im;
	private JTextField textPassword;
	private JButton btnLogin;
	private JLabel lblUsername;
	private JLabel lblPassword;
	private JComboBox comboBoxUsername;

	public LoginPanel() {
		getLoginPanel();
	}

	/**
	 * Create the panel.
	 */
	public LoginPanel(Image im) {
		setOpaque(false);
		this.im = im;
		
		getLoginPanel();
	}
	
	private void getLoginPanel(){
		setLayout(null);

		btnLogin = new JButton("登  录");
		btnLogin.setFont(new Font("宋体", Font.PLAIN, 15));
		btnLogin.setBounds(115, 236, 179, 35);
		add(btnLogin);

		textPassword = new JTextField();
		textPassword.setFont(new Font("宋体", Font.PLAIN, 15));
		textPassword.setBounds(106, 150, 228, 30);
		add(textPassword);
		textPassword.setColumns(10);

		lblUsername = new JLabel("用户名：");
		lblUsername.setForeground(Color.BLACK);
		lblUsername.setFont(new Font("宋体", Font.PLAIN, 15));
		lblUsername.setBounds(44, 105, 65, 30);
		add(lblUsername);

		lblPassword = new JLabel("密   码：");
		lblPassword.setForeground(Color.BLACK);
		lblPassword.setFont(new Font("宋体", Font.PLAIN, 15));
		lblPassword.setBounds(44, 150, 65, 30);
		add(lblPassword);

		comboBoxUsername = new JComboBox();
		comboBoxUsername.setFont(new Font("宋体", Font.PLAIN, 15));
		comboBoxUsername.setEditable(true);
		comboBoxUsername.setBounds(106, 101, 228, 30);
		add(comboBoxUsername);
	}

	@Override
	protected void paintComponent(Graphics g) {
//		 g.drawImage(im, 0, 0, width, height, this);
		 g.drawImage(im, 0, 0, this);
	}
}
